<template>
	<view class="">
		<u-loading-page :loading="isloading"></u-loading-page>
		<view class="app" v-show="!isloading">
			<view class="tabs-box"><u-tabs :current="current" :list="list" @click="clickTabs"></u-tabs></view>
			<u-form labelWidth="160rpx" ref="uForm" :model="obj">
				<swiper @change="changeswiper" :current="current" class="swiper-div" :interval="3000" :duration="1000">
					<!-- 基础 -->
					<swiper-item>
						<scroll-view scroll-y="true" class="swiper-div" :scroll-top="ScrollTop">
							<view class="u-p-l-30 u-p-r-20">
								<u-form-item prop="name" required label="商品名称"><u-input maxlength="32" v-model="obj.name"></u-input></u-form-item>
								<u-form-item required label="副标题"><u-input maxlength="32" v-model="obj.subtitle"></u-input></u-form-item>
								<u-form-item required label="商品主图"><selectimg key_id="master"></selectimg></u-form-item>
								<u-form-item required label="轮播图"><selectimg key_id="slideshow"></selectimg></u-form-item>
								<u-form-item required label="分享图">
									<view class="img-box"><selectimg key_id="share"></selectimg></view>
								</u-form-item>
								<u-form-item required label="所属分类">
									<view @click="showcate = true">
										<u-input v-model="obj.classify_value" readonly placeholder="选择分类">
											<template slot="suffix">
												<u-icon name="arrow-down"></u-icon>
											</template>
										</u-input>
									</view>
								</u-form-item>
								<u-form-item v-if="ismall" label="排序"><u-input v-model="obj.sort"></u-input></u-form-item>
								<u-form-item label="虚拟销量"><u-switch v-model="obj.is_virtual" :activeValue="1" :inactiveValue="0" size="20"></u-switch></u-form-item>
								<u-form-item label="虚拟销量" v-if="obj.is_virtual == 1"><u-input v-model="obj.virtual_sell"></u-input></u-form-item>
								<u-form-item label="商品限购"><u-switch v-model="obj.is_limitation" :activeValue="1" :inactiveValue="0" size="20"></u-switch></u-form-item>
								<u-form-item label="限购类型" v-if="obj.is_limitation == 1">
									<u-radio-group v-model="obj.limitation_type">
										<u-radio customStyle="margin-right:32rpx" label="单笔限购" :name="1"></u-radio>
										<u-radio label="历史限购" :name="2"></u-radio>
									</u-radio-group>
								</u-form-item>
								<u-form-item label="限购数量" v-if="obj.is_limitation == 1"><u-input v-model="obj.limitation"></u-input></u-form-item>
								<u-form-item label="库存类型">
									<u-radio-group v-model="obj.inventory_type" iconPlacement="right" placement="column">
										<u-radio customStyle="margin-bottom:16rpx" label="下单前减库存" :name="1"></u-radio>
										<u-alert customStyle="margin-bottom:16rpx" type="primary" description="买家提交订单, 扣减库存数量, 可能会存在 恶意占用库存风险"></u-alert>
										<u-radio customStyle="margin-bottom:16rpx" label="永不减库存" :name="2"></u-radio>
										<u-alert customStyle="margin-bottom:16rpx" type="primary" description="无论在下单还是在支付成功, 该商品永远不会扣减库存数量"></u-alert>
										<u-radio customStyle="margin-bottom:16rpx" label="付款减库存" :name="3"></u-radio>
										<u-alert type="primary" description="买家支付成功, 扣减库存数量, 可能会存在超卖风险"></u-alert>
									</u-radio-group>
								</u-form-item>
								<u-form-item label="商品标签">
									<view class="u-flex u-flex-wrap">
										<view class="u-m-r-20  u-m-b-20" v-for="tag in obj.label"><u-tag closable :text="tag" @close="handleClose(tag)"></u-tag></view>
										<view class="" style="height: 60rpx;width: 120rpx;">
											<u-input
												size="small"
												fontSize="24rpx"
												v-if="inputVisible"
												v-model="inputValue"
												@keyup.enter.native="handleInputConfirm"
												@blur="handleInputConfirm"
											></u-input>
										</view>
										<u-button size="small" customStyle="width:160rpx" @click="showInput">添加</u-button>
									</view>
								</u-form-item>
								<u-form-item label="退换货类型">
									<u-checkbox-group v-model="obj.retreat" iconPlacement="right" placement="column">
										<u-checkbox customStyle="margin-bottom:16rpx" label="退款" :name="1"></u-checkbox>
										<u-checkbox customStyle="margin-bottom:16rpx" label="退货退款" :name="2"></u-checkbox>
										<u-checkbox label="换货" :name="3"></u-checkbox>
									</u-checkbox-group>
								</u-form-item>
								<u-form-item label="商品表单" v-if="formlist.length > 0">
									<u-radio-group v-model="obj.form_open">
										<u-radio :label="1">开启</u-radio>
										<u-radio :label="0">关闭</u-radio>
									</u-radio-group>
								</u-form-item>
								<u-form-item label="选择表单" v-if="obj.form_open">
									<!--  <el-select v-model="obj.template_id" placeholder="请选择">
							      <el-option
							        v-for="item in formlist"
							        :key="item.id"
							        :label="item.title"
							        :value="item.id">
							      </el-option>
							    </el-select> -->
								</u-form-item>
								<u-form-item label="提取方式">
									<u-checkbox-group v-model="obj.deliver" iconPlacement="right" placement="column">
										<u-checkbox customStyle="margin-bottom:16rpx" label="快递" :name="'1'"></u-checkbox>
										<u-checkbox v-if="$Addons.indexOf(11) > -1" customStyle="margin-bottom:16rpx" label="自提" :name="'2'"></u-checkbox>
										<u-checkbox v-if="$Addons.indexOf(16) > -1" label="同城" :name="'3'"></u-checkbox>
									</u-checkbox-group>
									<!-- <div v-if="storeList != 0" style="color:#909399;font-size:12px;">默认三种类型都支持</div> -->
								</u-form-item>
								<u-form-item label="运费设置">
									<u-radio-group v-model="obj.ft_type" iconPlacement="right" placement="column">
										<u-radio customStyle="margin-bottom:16rpx" label="包邮" :name="0"></u-radio>
										<u-radio customStyle="margin-bottom:16rpx" label="选择模板" :name="1"></u-radio>
										<u-radio customStyle="margin-bottom:16rpx" label="统一运费" :name="2"></u-radio>
									</u-radio-group>
								</u-form-item>
								<u-form-item v-if="obj.ft_type == 1" label="运费模板">
									<view class="" @click="showtemp = true">
										<u-input v-model="ft_name" readonly placeholder="选择运费模板">
											<template slot="suffix">
												<u-icon name="arrow-down"></u-icon>
											</template>
										</u-input>
									</view>
								</u-form-item>
								<u-form-item v-if="obj.ft_type == 2" label="统一运费"><u-input v-model="obj.ft_price"></u-input></u-form-item>
							</view>
						</scroll-view>
					</swiper-item>
					<!-- 售价 -->
					<swiper-item>
						<scroll-view scroll-y="true" class="swiper-div">
							<view class="u-p-l-40 u-p-r-20">
								<u-form-item label="多规格">
									<view class="u-flex u-flex-between u-flex-1">
										<u-switch @change="changesku" v-model="obj.has_sku" :activeValue="1" :inactiveValue="0" size="20"></u-switch>
										<view class="u-flex" v-if="obj.has_sku">
											<u-button @click="showaddskuing" size="mini" type="primary" customStyle="width:150rpx;margin-right:20rpx">添加规格</u-button>
											<u-button @click="showbatch = true" size="mini" type="primary" customStyle="width:150rpx">批量设置</u-button>
										</view>
									</view>
								</u-form-item>
								<block v-if="obj.has_sku">
									<view class="u-m-b-20" v-for="(item, i) in obj.sku_value" :key="i">
										<view class="u-flex u-flex-between "><u--text bold size="32rpx" :text="item.name"></u--text></view>
										<view class="u-flex u-m-t-20">
											<u-tag class="u-m-r-20" :text="data.value" :key="index" v-for="(data, index) in item.attrValue" plain size="mini"></u-tag>
										</view>
									</view>
									<block v-for="(item, i) in tabledata">
										<u-form-item label="规格名称"><u-text :text="item.pvs_value"></u-text></u-form-item>
										<u-form-item label="划线价"><u-input fontSize="24rpx" v-model="item.original_price"></u-input></u-form-item>
										<u-form-item label="售价"><u-input fontSize="24rpx" v-model="item.sell_price"></u-input></u-form-item>
										<u-form-item label="库存"><u-input fontSize="24rpx" v-model="item.total"></u-input></u-form-item>
										<u-form-item label="重量"><u-input fontSize="24rpx" v-model="item.weight"></u-input></u-form-item>
										<u-form-item label="规格图">
											<view class="img-box" v-if="item.sku_id"><selectimg :key_id="'sku' + item.sku_id"></selectimg></view>
											<view class="img-box" v-else><selectimg :key_id="'sku' + i"></selectimg></view>
										</u-form-item>
										<u-line></u-line>
									</block>
								</block>
								<block v-else>
									<u-form-item label="默认售价"><u-input v-model="obj.sell_price"></u-input></u-form-item>
									<u-form-item label="默认划线价"><u-input v-model="obj.original_price"></u-input></u-form-item>
									<u-form-item v-if="isEdit" label="剩余库存"><u-input v-model="obj.total"></u-input></u-form-item>
									<u-form-item v-else label="默认库存"><u-input v-model="obj.total"></u-input></u-form-item>
									<u-form-item label="默认重量"><u-input v-model="obj.weight"></u-input></u-form-item>
								</block>
							</view>
						</scroll-view>
					</swiper-item>
					<!-- 商品详情 -->
					<swiper-item>
						<view class="" v-if="!isloading">
							<jinEdit @editOk="getcontent" :html="obj.content" height="calc(100vh - 200rpx)" placeholder="请输入内容" uploadFileUrl="/#"></jinEdit>
						</view>
					</swiper-item>
					<!-- 附加属性 -->
					<swiper-item>
						<scroll-view scroll-y="true" class="swiper-div">
							<view class="u-p-l-40 u-p-r-20">
								<u-form-item label="附加属性">
									<view class="u-flex u-flex-between u-flex-1">
										<u-switch v-model="obj.has_attach" :activeValue="1" :inactiveValue="0" size="20"></u-switch>
										<view class="u-flex" v-if="obj.has_attach">
											<u-button @click="addattach" size="mini" type="primary" customStyle="width:150rpx;margin-right:20rpx">添加属性</u-button>
										</view>
									</view>
								</u-form-item>
								<block v-for="(item, i) in attachlist" v-if="obj.has_attach">
									<u-form-item label="规格名称">
										<u-input v-model="item.name"></u-input>
										<u-icon class="u-m-l-20" name="close-circle-fill" @click="removeattach(i)"></u-icon>
									</u-form-item>
									
									
									<u-form-item label="选择下限"><u-number-box :min="0" v-model="item.need" :max="item.toplimit"></u-number-box></u-form-item>
									<u-form-item label="选择上限"><u-number-box :min="1" v-model="item.toplimit" :max="item.list.length"></u-number-box></u-form-item>
									<u-divider text="规格"></u-divider>
									<block v-for="(data, index) in item.list">
										<u-form-item label="规格名">
											<u-input v-model="data.name"></u-input>
											<u-icon class="u-m-l-20" name="close-circle-fill" @click="removeattachitem(i, index)"></u-icon>
										</u-form-item>
										<u-form-item label="附加价格"><u-input fontSize="24rpx" v-model="data.price"></u-input></u-form-item>
										<u-form-item label="库存"><u-input fontSize="24rpx" v-model="data.total"></u-input></u-form-item>
									</block>
									<u-form-item label="">
										<view class="u-m-l-20"><u-button @click="addattachitem(i)" customStyle="width:150rpx" size="mini" type="primary">添加规格</u-button></view>
									</u-form-item>
									<u-line></u-line>
								</block>
							</view>
						</scroll-view>
					</swiper-item>
					<!-- 商品参数 -->
					<swiper-item>
						<scroll-view scroll-y="true" class="swiper-div">
							<view class="u-p-l-40 u-p-r-20">
								<u-form-item label="商品参数">
									<view class="u-flex u-flex-between u-flex-1">
										<u-switch v-model="obj.has_parameter" :activeValue="1" :inactiveValue="0" size="20"></u-switch>
										<view class="u-flex" v-if="obj.has_parameter">
											<u-button @click="addParameter" size="mini" type="primary" customStyle="width:150rpx;margin-right:20rpx">添加参数</u-button>
										</view>
									</view>
								</u-form-item>
								<block v-for="(item, i) in obj.parameter" v-if="obj.has_parameter">
									<u-form-item label="参数名称">
										<u-input v-model="item.key"></u-input>
										<u-icon class="u-m-l-20" name="close-circle-fill" @click="removeParameter(i)"></u-icon>
									</u-form-item>
									<u-form-item label="参数值"><u-input fontSize="24rpx" v-model="item.value"></u-input></u-form-item>

									<u-line></u-line>
								</block>
							</view>
						</scroll-view>
					</swiper-item>
					<!-- 积分 -->
					<swiper-item>
						<scroll-view scroll-y="true" class="swiper-div">
							<view class="u-p-l-40 u-p-r-20">
								<u-form-item label="购物积分">
									<u-switch v-model="obj.is_integral" :activeValue="1" :inactiveValue="0" size="20"></u-switch>

									<!-- <div style="color:#909399;font-size:12px;">如果不参与积分，购买该商品则不获得积分</div> -->
								</u-form-item>
								<u-form-item label="购物积分" v-if="obj.is_integral == 1">
									<u-radio-group v-model="is_base_integral" iconPlacement="right" placement="column">
										<u-radio customStyle="margin-bottom:16rpx" :name="0" label="系统设置"></u-radio>
										<u-radio :name="1" label="按商品设置"></u-radio>
									</u-radio-group>
								</u-form-item>
								<u-form-item label="购买获得" v-if="obj.is_integral == 1 && is_base_integral == 1">
									<u-input v-model="obj.integral">
										<template slot="suffix">
											<text>积分</text>
										</template>
									</u-input>
								</u-form-item>
								<u-form-item label="积分抵扣">
									<u-radio-group v-model="obj.my_integral_deduction" iconPlacement="right" placement="column">
										<u-radio customStyle="margin-bottom:16rpx" :name="0" label="关闭"></u-radio>
										<u-radio customStyle="margin-bottom:16rpx" :name="1" label="不限制抵扣数量"></u-radio>
										<u-radio :name="2" label="自定义最多抵扣"></u-radio>
									</u-radio-group>
								</u-form-item>
								<u-form-item label="最多抵扣" v-if="obj.my_integral_deduction == 2">
									<u-input v-model="obj.integral_maximum">
										<template slot="suffix">
											<text>元</text>
										</template>
									</u-input>
								</u-form-item>
							</view>
						</scroll-view>
					</swiper-item>
					<!-- 分销 -->
					<swiper-item v-if="$Agentrank>0">
						<scroll-view scroll-y="true" class="swiper-div">
							<view class="u-p-l-40 u-p-r-20">
								<u-form-item label="参与分销"><u-switch v-model="obj.is_distribution" :activeValue="1" :inactiveValue="0" size="20"></u-switch></u-form-item>
								<u-alert type="primary" description="如果不参与分销，则不产生分销佣金"></u-alert>
								<u-form-item label="佣金设置" v-if="obj.is_distribution == 1">
									<u-radio-group v-model="obj.is_base_distribution" iconPlacement="right" placement="column">
										<u-radio customStyle="margin-bottom:16rpx" :name="0" label="系统设置"></u-radio>
										<u-radio customStyle="margin-bottom:16rpx" :name="1" label="按商品设置"></u-radio>
									</u-radio-group>
								</u-form-item>
								<u-alert v-if="obj.is_base_distribution == 1" type="primary" description="点击输入框前置文字改变佣金类型"></u-alert>
								<block v-for="(data, index) in gradelist" v-if="obj.is_base_distribution == 1">
									<u-gap height="40rpx"></u-gap>
									<u--text bold size="32rpx" :text="data.name"></u--text>
									<block v-for="(item, i) in data.distribution" v-if="i < $Agentrank">
										<u-form-item :label="item.l_name">
											<u-input v-model="item.figure" inputAlign="right">
												<text slot="prefix" @click="item.type = !item.type">{{ item.type == 0 ? '佣金比例' : '固定佣金' }}</text>
												<text slot="suffix">{{ item.type == 0 ? '%' : '元' }}</text>
											</u-input>
										</u-form-item>
									</block>
									<u-line></u-line>
								</block>
							</view>
						</scroll-view>
					</swiper-item>
					<!-- 会员价 -->
					<swiper-item v-if="$Addons.indexOf(20) > -1">
						<scroll-view scroll-y="true" class="swiper-div">
							<view class="u-p-l-40 u-p-r-20">
								<u-form-item label="会员折扣">
									<u-radio-group v-model="obj.level_price_type" iconPlacement="right" placement="column" s>
										<u-radio customStyle="margin-bottom:16rpx" :name="0" label="不参与"></u-radio>
										<u-radio customStyle="margin-bottom:16rpx" :disabled="MembershipList.length == 0" :name="2" label="系统默认"></u-radio>
										<u-radio :disabled="MembershipList.length == 0" :name="1" label="根据会员等级"></u-radio>
									</u-radio-group>
								</u-form-item>
								<block v-if="obj.level_price_type == 1 && MembershipList.length > 0">
									<u-alert type="primary" description="点击输入框前置文字改变会员价类型"></u-alert>
									<u-form-item v-if="obj.has_sku == 0" v-for="(value, i) in obj.level_price.price" :label="MembershipList[i].name">
										<u-input v-model="value.price" inputAlign="right">
											<text slot="prefix" @click="value.type = value.type == 1 ? 2 : 1">{{ value.type == 1 ? '价格' : '折扣' }}</text>
											<text slot="suffix">{{ value.type == 1 ? '元' : '这' }}</text>
										</u-input>
									</u-form-item>
									<block v-for="(item, i) in tabledata" v-if="obj.has_sku">
										<u-form-item label="规格名称"><u-text :text="item.pvs_value"></u-text></u-form-item>
										<block v-for="(data, index) in MembershipList">
											<u-form-item :label="data.name">
												<u-input v-model="item.level_price.price[index].price" inputAlign="right">
													<text slot="prefix" @click="item.level_price.price[index].type = item.level_price.price[index].type == 1 ? 2 : 1">
														{{ item.level_price.price[index].type == 1 ? '价格' : '折扣' }}
													</text>
													<text slot="suffix">{{ item.level_price.price[index].type == 1 ? '元' : '这' }}</text>
												</u-input>
											</u-form-item>
										</block>

										<u-line></u-line>
									</block>
								</block>
							</view>
						</scroll-view>
					</swiper-item>
				</swiper>
			</u-form>
			<view class="u-flex u-flex-items-center footer">
				<u-button size="small" shape="circle" @click="cancal">取消</u-button>
				<u-button class="u-m-l-60" type="primary" size="small" shape="circle" @click="saveData" v-has="{id: 3}">确定</u-button>
			</view>
			<u-popup :show="showaddsku" @close="showaddsku = false">
				<view class="u-flex u-p-40 u-flex-items-center">
					<!-- 		<u-input placeholder="输入规格名称"></u-input> -->
					<view class="u-m-l-20">
						<u-button :disabled="sku_valuelist.length == 3" customStyle="width:200rpx" size="mini" type="primary" @click="addSkuItem">添加规格</u-button>
					</view>
				</view>
				<u-line></u-line>
				<scroll-view scroll-y="true" class="sku-div">
					<view class="u-p-l-40 u-p-r-20">
						<u-form labelWidth="140rpx">
							<block v-for="(item, i) in sku_valuelist">
								<u-form-item label="规格名称">
									<u-input v-model="item.name"></u-input>
									<u-icon class="u-m-l-20" name="close-circle-fill" @click="removeSkuItem(i)"></u-icon>
								</u-form-item>
								<u-form-item v-for="(data, index) in item.attrValue" :label="index == 0 ? '规格属性' : ' '">
									<u-input v-model="data.value" :key="index"></u-input>
									<u-icon class="u-m-l-20" @click="removeSkuValue(i, index)" name="close-circle-fill"></u-icon>
								</u-form-item>
								<u-form-item label="">
									<!-- <u-input placeholder="输入规格名称"></u-input> -->
									<view class="u-m-l-20"><u-button @click="addSkuValue(i)" customStyle="width:100rpx" size="mini" type="primary">添加</u-button></view>
								</u-form-item>
								<u-line></u-line>
							</block>
						</u-form>
					</view>
				</scroll-view>
				<view class="u-flex u-flex-items-center footer">
					<u-button size="small" shape="circle" @click="showaddsku = false">取消</u-button>
					<u-button class="u-m-l-60" type="primary" size="small" shape="circle" @click="savesku">确定</u-button>
				</view>
			</u-popup>
			<u-popup mode="top" :show="showbatch" @close="showbatch = false">
				<view class="u-p-40">
					<u-form labelWidth="140rpx">
						<u-form-item label="划线价"><u-input v-model="batch.original_price" fontSize="24rpx"></u-input></u-form-item>
						<u-form-item label="销售价"><u-input v-model="batch.sell_price" fontSize="24rpx"></u-input></u-form-item>
						<u-form-item label="库存"><u-input v-model="batch.total" fontSize="24rpx"></u-input></u-form-item>
						<u-form-item label="重量"><u-input v-model="batch.weight" fontSize="24rpx"></u-input></u-form-item>
					</u-form>
					<u-gap height="30rpx"></u-gap>
					<u-button @click="setAll" size="small" type="primary" shape="circle">批量设置</u-button>
				</view>
			</u-popup>
			<u-popup mode="top" :show="showcate" @open="setclassify" @close="showcate = false">
				<cascader :allcate="allcate" ref="cascader" @close="showcate = false" @change="changecheck" :activelist="classify_id" :List="cateList"></cascader>
			</u-popup>
			<u-picker :show="showtemp" :columns="templist" keyName="name" @confirm="gettemp"></u-picker>
		</view>
		<lc-fab-touch ref="fab" :content="content" horizontal="right" vertical="bottom" direction="horizontal" @trigger="trigger" @fabClick="fabClick" />
		<u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
import jinEdit from '@/components/jin-edit/jin-edit.vue';
import {mapState, mapMutations} from 'vuex';
import {doCombination, objCopy} from '@/util/index';
export default {
	onShareAppMessage() {
		return this.wxShare();
	},
	data() {
		return {
			list: [
				{
					name: '基础'
				},
				{
					name: '价格'
				},
				{
					name: '详情'
				},
				{
					name: '附加属性'
				},
				{
					name: '参数'
				},
				{
					name: '积分'
				},
				{
					name: '分销'
				},
				{
					name: '会员价'
				}
			],

			tabledata: [],
			MembershipList: [],
			batch: {
				sell_price: '',
				total: '',
				weight: '',
				original_price: ''
			},
			ismall: true,
			showbatch: false,
			isEdit: false,
			showaddsku: false,
			showtemp: false,
			showcate: false,
			sku_valuelist: [],
			attachlist: [],
			current: 0,
			inputVisible: false,
			inputValue: '',
			templist: [],
			ft_name: '',
			obj: {
				retreat: ['1', '2', '3'],
				name: '', //商品名
				type: 0, //商品类型:0:实体商品,1:虚拟商品
				subtitle: '', //副标题
				master: '', //主图
				cover: false, //是否讲主图添加进轮播图
				slideshow: [], //轮播图
				share: '', //分享图
				classify_id: '', //分类id:1->2->3,1->4,string
				classify_value: '', //分类值:1级->2级->3级,1级->2级1,string
				weight: 0, //重量
				deliver: ['1', '2', '3'], //提取方式:1:快递,2:自提,3:同城
				ft_type: 0, //运费:0:包邮,1:模板,2:统一价格
				ft_id: '', //配送模板id,ft_type=1的时候需要填写
				ft_price: 0, //统一配送价格,ft_type=2的时候需要填写
				total: 0, //总量，库存?
				original_price: 0, //原价
				sell_price: 0, //售价
				level_price: {
					type: 1,
					price: []
				}, //会员价
				is_original_price: 0, //是否开启原价:0:不开启,1:开启
				integral: 0, //购买获得积分
				is_integral: 1, //是否参与获得积分
				content: '', //商品详情
				sort: 0, //排序
				has_parameter: 0, //是否拥有参数,0:不拥有,1:拥有
				parameter: [], //参数对象
				is_virtual: 0, //是否开启虚拟销量:0:不开启,1:开启
				virtual_sell: 0, //虚拟销量
				is_limitation: 0, //是否开启限购
				limitation: 0, //限购数量
				limitation_type: 1, //限购类型: 1-单笔限购 2-历史限购
				inventory_type: 1, //库存类型:1:下单前减库存,2:永不减库存,3:付款减库存
				label: ['正品保证', '假一赔十', '七天无理由退货'], //标签
				is_distribution: 0, //是否参与分销:0:不参与,1:参与
				is_base_distribution: 0, //启用全局分销配置:0:是,1:不是
				level_price_type: 0, //是否会员商品 0 不参与 2系统默认 1 自定义
				form_open: 0,
				template_id: '',
				has_attach: 0, //是否含有附加属性，0没有1有
				attach_value: [],
				distribution: [
					{
						level: 1,
						type: 0,
						figure: 0
					},
					{
						level: 2,
						type: 0,
						figure: 0
					},
					{
						level: 3,
						type: 0,
						figure: 0
					}
				], //分销数据
				integral: 0,
				integral_maximum: 0,
				integral_deduction: 0,
				my_integral_deduction: 0,
				has_sku: 0, //是否有sku:0:没有,1:有
				sku_value: [
					{
						name: '颜色',
						attrValue: [
							{
								value: '红色'
							},
							{
								value: '黄色'
							},
							{
								value: '蓝色'
							}
						],
						has_pic: 0
					},
					{
						name: '尺码',
						attrValue: [
							{
								value: 'L'
							},
							{
								value: 'M'
							},
							{
								value: 'S'
							}
						],
						has_pic: 0
					}
				], //sku对象{“1&颜色”:[“1&红色”,”2&白色”],”2&尺码”:[“3&L”,”4&M”]},当has_sku为1时必选
				sku: [
					{
						pvs: '颜色:白色,尺码:L',
						weight: 0,
						inventory: {
							original_price: 0,
							sell_price: 0,
							total: 0
						}, //有sku不开启门店库存下的库存对象(is_store_inventory为0时必选)
						store_sku_inventory: [
							{
								store_id: '',
								original_price: 0,
								sell_price: 0,
								total: 0
							}
						] //有sku的门店库存对象数组(is_store_inventory为1时必选)
					}
				], //sku对象数组(当has_sku为1时必选)
				is_store_inventory: 0, //是否开启门店库存,0:不开启，1:开启
				store_inventory: [
					{
						store_id: '',
						total: 0
					}
				] //没有sku的门店库存对象数组(当has_sku为0,is_store_inventory为1时必选)
			},

			is_base_integral: 0,
			gradelist: [],
			isEdit: false,
			isloading: true,
			cateList: [],
			allcate: [],
			classify_id: [],
			isCopy: false,
			rules: {
				name: [
					{
						type: 'string',
						required: true,
						message: '请输入商品名称',
						trigger: ['blur', 'change']
					}
				]
			},
			content: [
				{
					iconPath: 'home',
					selectedIconPath: 'home-fill',
					text: '首页',
					active: false
				}
			],
			ScrollTop: 0,
			formlist: []
		};
	},
	computed: {
		...mapState({
			$SelectData: state => state.$SelectData,
			$Addons: state => state.$Addons,
			$Agentrank: state => state.$Agentrank
		})
	},
	onReady() {
		this.$refs.uForm.setRules(this.rules);
	},
	components: {
		jinEdit
	},
	onLoad(e) {
		if (e.id) {
			this.getdetail(e.id);
			this.isEdit = true;
		} else {
			this.isloading = false;
			this.setimg('master', 1);
			this.setimg('share', 1);
			this.setimg('slideshow', 2);
		}
		if (e.isCopy) {
			this.isCopy = e.isCopy;
		}

		this.getAllProCate();
		this.gettemplist();
		this.getagentgradeist();
		if (this.$Addons.indexOf(20) > -1) {
			this.getMembershipList();
		} else {
			let i = this.list.findIndex(_ => _ == '会员价');
			this.list.splice(i, 1);
		}
		if(this.$Agentrank==0){
			let i = this.list.findIndex(_ => _ == '分销');
			this.list.splice(i, 1);
		}
	},
	methods: {
		trigger(e) {
			if (e.index == 0) {
				uni.$u.route({
					url: 'pages/index/index'
				});
			}
		},
		fabClick(e) {},
		/*接口*/
		//获取所有商品分类
		getAllProCate() {
			//this.isLoading = true;
			uni.$u.http.get('/shop/classify', {}, {custom: {id: 3}}).then(res => {
				//this.isLoading = false;
				//处理分类数据
				let allcate = [];
				let l = [],
					_l = res.msg.data;
				_l.forEach(e => {
					let o = {};
					(o.value = e.id), (o.label = e.name);
					o.children = [];
					allcate.push(o);
					//循环二级
					if (e.children && e.children.length > 0) {
						e.children.forEach(a => {
							let o1 = {};
							o1.value = e.id + '->' + a.id;
							o1.label = a.name;
							o1.children = [];
							o.children.push(o1);
							allcate.push(o1);
							//循环三级
							if (a.children && a.children.length > 0) {
								a.children.forEach(x => {
									o1.children.push({
										value: o1.value + '->' + x.id,
										label: x.name
									});
									allcate.push({
										value: o1.value + '->' + x.id,
										label: x.name
									});
								});
							}
						});
					}
					l.push(o);
				});
				this.cateList = l;
				this.allcate = allcate;
			});
		},
		getdetail(id) {
			this.isloading = true;
			uni.$u.http
				.get('/shop/spu/' + id, {custom: {id: 3}})
				.then(res => {
					let o = res.msg;
					let max = Number(o.integral_maximum);
					if (o.integral_deduction == 1) {
						if (max == 0) {
							o.my_integral_deduction = 1;
						} else {
							o.my_integral_deduction = 2;
						}
					} else {
						o.my_integral_deduction = 0;
					}
					if (o.integral > 0 && o.is_integral) {
						this.is_base_integral = 1;
					} else {
						this.is_base_integral = 0;
					}
					o.total = o.total - o.sell;
					if (o.retreat) {
						o.retreat = o.retreat.split(',');
					} else {
						o.retreat = [];
					}
					if (o.deliver) {
						o.deliver = o.deliver.split(',');
					} else {
						o.deliver = [];
					}
					if (o.level_price) {
						let newprice = [];
						this.MembershipList.forEach(a => {
							let i = o.level_price.price.findIndex(_ => _.level == a.level);

							if (i > -1) {
								let b = o.level_price.price[i];
								newprice.push({level: b.level, price: b.price, type: b.type});
							} else {
								newprice.push({level: a.level, price: 0, type: 1});
							}
						});
						o.level_price.price = newprice;
					} else {
						o.level_price = this.initlevelprice();
					}
					if (o.has_sku) {
						o.sku.forEach(a => {
							if (a.inventory.level_price) {
								if (typeof a.inventory.level_price == 'string') {
									a.inventory.level_price = JSON.parse(a.inventory.level_price);
								}

								this.MembershipList.forEach((d, n) => {
									let i = a.inventory.level_price.price.findIndex(_ => _.level == d.level);
									if (i == -1) {
										a.inventory.level_price.price.splice(n, 0, {level: d.level, price: 0, type: 1});
										// a.inventory.level_price.price.push({level: c.level, price: 0, type: 1});
									}
								});

								o.level_price_type = a.inventory.level_price.type;
							}
						});
					} else {
						o.level_price_type = o.level_price.type;
					}
					if (o.has_attach && o.attach_value) {
						o.attach_value.forEach(a => {
							let list = [];
							a.attrValue.forEach(v => {
								list.push({
									name: v[1],
									price: v[2],
									total: v[4],
									id: v[0],
									sell: v[3] - v[4]
								});
							});
							this.attachlist.push({
								id: a.id,
								name: a.name,
								need: a.need,
								toplimit: a.toplimit,
								list: list
							});
						});
					}

					this.getagentgradeist(o.distribution);
					objCopy(this.obj, o);
					this.setimg('master', 1);
					this.setimg('share', 1);
					this.setimg('slideshow', 2);
					if (o.has_sku) {
						this.formatSkuData();
					}

					this.isloading = false;
					//转换类别数据
					let c = [];
					c = o.classify_id.split(',');
					// c.forEach((e, i) => {
					// 	c[i] = c[i].split('->');
					// });
					this.classify_id = c;

					console.log(this.classify_id);
				})
				.catch(err => {});
		},

		//运费模板
		gettemplist() {
			uni.$u.http
				.get('/shop/freight/temp', {custom: {id: 3}})
				.then(res => {
					this.templist.push(res.msg);
				})
				.catch(err => {});
		},
		//分销等级
		getagentgradeist(distribution) {
			uni.$u.http
				.post('/madmin/agent/grade/list', {page: 1, size: 10}, {custom: {id: 3}})
				.then(res => {
					let list = res.msg;
					list.unshift({id: 0, name: '默认等级'});
					list.forEach(a => {
						a.distribution = [
							{type: 0, level: 1, figure: '0', l_name: '一级分销'},
							{type: 0, level: 2, figure: '0', l_name: '二级分销'},
							{type: 0, level: 3, figure: '0', l_name: '三级分销'}
						];
					});
					if (distribution && distribution.length > 0) {
						distribution.forEach(d => {
							if (!Array.isArray(d)) {
								list[0].distribution = distribution;
							} else {
								let c = d[0];
								let i = list.findIndex(_ => _.id == c[0]);
								if (i > -1) {
									list[i].distribution = d[1];
								} else {
								}
							}
						});
					}
					this.gradelist = list;
				})
				.catch(err => {});
		},
		//会员等级
		getMembershipList() {
			uni.$u.http
				.post('/madmin/membership/level/list?page=1&size=100', {}, {custom: {id: 3}})
				.then(res => {
					let MembershipList = res.msg.data;

					MembershipList.forEach(a => {
						a.price = 0;
						a.type = 1;
						this.obj.level_price.type = this.obj.level_price_type;
						this.obj.level_price.price.push({
							price: 0,
							type: 1,
							level: a.level
						});
					});
					this.MembershipList = MembershipList;
					if (this.$route.params.onlyShow) {
						//只查看
						this.onlyShow = true;
						this.getPro(this.$route.params.id);
					} else {
						if (this.$route.query.id) {
							//编辑状态
							this.isEdit = true;
							this.getPro(this.$route.query.id);
						} else {
							this._obj = Object.assign({}, this.obj);
						}
					}
				})
				.catch(err => {});
		},
		//保存数据
		async saveData() {
			let saveobj = JSON.parse(JSON.stringify(this.obj));

			//封装类别数据(id)
			saveobj.classify_id = [];
			saveobj.classify_value = [];
			let s = [];
			this.classify_id.forEach(a => {
				let i = this.allcate.findIndex(_ => _.value == a);
				saveobj.classify_id.push(this.allcate[i].value);
				saveobj.classify_value.push(this.allcate[i].label);
			});
			saveobj.classify_id = saveobj.classify_id.join(',');
			saveobj.classify_value = saveobj.classify_value.join(',');

			//封装SKU数据
			let li = [];

			this.tabledata.forEach((e, index) => {
				let o = {};
				o.pvs = '';
				for (let i = 0, l = this.keylist.length; i < l; i++) {
					if (this.keylist[i] != '图片') {
						o.pvs += this.keylist[i] + ':' + e['k' + i] + ',';
					}
				}
				//生成pvs参数
				o.pvs = o.pvs.substring(0, o.pvs.length - 1);
				o.weight = e.weight;
				if (e.sku_id) {
					o.pic = this.$SelectData['sku' + e.sku_id].imgList[0];
				} else {
					o.pic = this.$SelectData['sku' + index].imgList[0];
				}

				o.id = e.pid;

				//生成具体价格参数
				e.level_price.type = saveobj.level_price_type;
				o.inventory = {
					original_price: e.original_price,
					sell_price: e.sell_price,
					id: e.id,
					sku_id: e.sku_id,
					level_price: JSON.stringify(e.level_price),
					total: this.isEdit && !this.isCopy ? parseInt(e.total) + parseInt(e.sell || 0) : e.total
				};
				li.push(o);
			});

			let attach_value = [];
			let attach_value_text = [];
			let is_attach = true;
			this.attachlist.forEach(a => {
				let list = [];
				a.list.forEach(v => {
					let attach = a.name + ':' + v.name;
					if (attach_value_text.indexOf(attach) == -1) {
						attach_value_text.push(attach);
					} else {
						uni.$u.toast(attach + '重复！');
						is_attach = false;
					}
					let l = [];
					if (v.id && !this.isCopy) {
						l.push(v.id);
					}
					l.push(v.name);
					l.push(v.price);
					if (v.sell && this.isEdit && !this.isCopy) {
						let total = Number(v.total) + Number(v.sell);
						l.push(total);
					} else {
						l.push(v.total);
					}

					list.push(l);
				});
				let data = {
					name: a.name,
					toplimit: a.toplimit,
					need: a.need,
					attrValue: list
				};
				if (a.id && !this.isCopy) {
					data.id = a.id;
				}
				attach_value.push(data);
			});
			if (!is_attach) {
				return false;
			}
			//赋值sku数据
			saveobj.total = this.isEdit && !this.isCopy ? parseInt(saveobj.total) + parseInt(saveobj.sell || 0) : saveobj.total;
			saveobj.sku = li;
			if (saveobj.has_sku) {
				let str = await this.Validate(saveobj);
				if (str) {
					uni.$u.toast(str);
					return false;
				}
			}
			this.$refs.uForm
				.validate()
				.then(res => {
					if (saveobj.ft_type == 1) {
						if (!saveobj.ft_id) {
							uni.$u.toast('请选择运费模板');
							this.activeName = 'p1';
							return false;
						}
					}
					if (saveobj.content == '') {
						uni.$u.toast('商品详情不能为空');
						this.activeName = 'p2';
						return false;
					}

					//营销数据
					saveobj.integral_maximum = Number(saveobj.integral_maximum);
					if (saveobj.my_integral_deduction == 2) {
						saveobj.integral_deduction = 1;
						if (!saveobj.integral_maximum) {
							uni.$u.toast('请输入最大抵扣金额');
							return false;
						}
					}
					saveobj.master = this.$SelectData.master.imgList[0];
					saveobj.slideshow = [];
					let imglist = this.$SelectData.slideshow.imgList;
					imglist.forEach(a => {
						saveobj.slideshow.push({url: a});
					});
					if (saveobj.my_integral_deduction == 1) {
						saveobj.integral_deduction = 1;
						saveobj.integral_maximum = 0;
					}
					if (saveobj.my_integral_deduction == 0) {
						saveobj.integral_deduction = 0;
						saveobj.integral_maximum = 0;
					}
					if (!this.is_base_integral) {
						saveobj.integral = 0;
					}
					if (!saveobj.has_sku) {
						saveobj.level_price.type = saveobj.level_price_type;
						saveobj.level_price = JSON.stringify(saveobj.level_price);
					}
					let distribution = [];
					this.gradelist.forEach(a => {
						let d = [a.id, a.name];
						let c = [d, a.distribution];
						distribution.push(c);
					});
					saveobj.distribution = distribution;
					saveobj.retreat = saveobj.retreat.join(',');
					saveobj.deliver = saveobj.deliver.join(',');
					saveobj.attach_value = attach_value;
					//提交数据
					delete saveobj.cover;
					delete saveobj.my_integral_deduction;
					delete saveobj.level_price_type;
					// #ifndef APP-NVUE
					const eventChannel = this.getOpenerEventChannel();
					// #endif
					if (this.isCopy) {
						delete saveobj.id;
						delete saveobj.status;
						delete saveobj.status_text;
						delete saveobj.update_time;
						delete saveobj.create_time;
						delete saveobj.delete_time;
						delete saveobj.sell;
						saveobj.sku_value.forEach(item => {
							delete item.id;
							item.attrValue.forEach(itemr => {
								delete itemr.id;
								delete itemr.pid;
							});
						});
						saveobj.sku.forEach(item => {
							delete item.id;
							delete item.inventory.id;
							delete item.inventory.sku_id;
						});

						uni.$u.http
							.post('/shop/spu', saveobj, {custom: {id: 3}})
							.then(res => {
								this.$refs.uToast.show({
									message: '新增成功',
									type: 'success',
									complete: () => {
										eventChannel.emit('savesuccess', {});
										uni.$u.route({
											type: 'back'
										});
									}
								});
							})
							.catch(err => {});
					} else {
						if (this.isEdit) {
							uni.$u.http
								.put('/shop/spu/' + saveobj.id, saveobj, {custom: {id: 3}})
								.then(res => {
									this.$refs.uToast.show({
										message: '更新成功',
										type: 'success',
										complete: () => {
											eventChannel.emit('savesuccess', {});
											uni.$u.route({
												type: 'back'
											});
										}
									});
								})
								.catch(err => {});
						} else {
							uni.$u.http
								.post('/shop/spu', saveobj, {custom: {id: 3}})
								.then(res => {
									this.$refs.uToast.show({
										message: '新增成功',
										type: 'success',
										complete: () => {
											eventChannel.emit('savesuccess', {});
											uni.$u.route({
												type: 'back'
											});
										}
									});
								})
								.catch(err => {});
						}
					}
				})
				.catch(err => {});
			// this.$refs.shForm.validate(valid => {
			// 	if (valid) {

			// 	} else {
			// 		//校验没通过
			// 		return false;
			// 	}
			// });
		},
		/*图片*/
		setimg(key, type, url) {
			let list = [];
			if (type == 1) {
				if (this.obj[key]) {
					list.push(this.obj[key]);
				}
			} else if (type == 2) {
				this.obj[key].forEach(a => {
					list.push(a.url);
				});
			} else {
				if (url) {
					list.push(url);
				}
			}
			let data = {
				imgList: list,
				Limit: key == 'slideshow' ? 10 : 1
			};
			this.$set(this.$SelectData, key, data);
			this.$store.commit('setSelectData', this.$SelectData);
		},

		/*会员价*/
		initlevelprice() {
			let a = [];
			this.MembershipList.forEach(b => {
				a.push({
					price: 0,
					type: 1,
					level: b.level
				});
			});
			let b = {
				type: 0,
				price: a
			};
			return b;
		},
		/*swiper*/
		changeswiper(e) {
			this.current = e.detail.current;
		},
		clickTabs(data) {
			let index = data.index;
			this.current = index;
		},

		gettemp(e) {
			this.obj.ft_id = e.value[0].id;
			this.ft_name = e.value[0].name;
			this.showtemp = false;
		},

		/*标签*/
		showInput() {
			this.inputVisible = true;
		},
		handleInputConfirm() {
			let inputValue = this.inputValue;
			if (inputValue) {
				this.obj.label.push(inputValue);
			}
			this.inputVisible = false;
			this.inputValue = '';
		},
		handleClose(tag) {
			this.obj.label.splice(this.obj.label.indexOf(tag), 1);
		},
		/*规格*/
		async Validate(saveobj) {
			var str = false;
			// let i=this.obj.sku_value.findIndex(_=>{
			//     return _.attrValue.findIndex(b=>b.name=='')>-1
			// })
			// console.log(i)
			// return false
			saveobj.sku_value.forEach(a => {
				a.attrValue.forEach(b => {
					if (!b.value) {
						str = '规格"' + b.name + '"有子规格项未填写';
					}
				});
			});
			saveobj.sku.forEach(a => {
				if (!a.inventory.sell_price) {
					str = '规格"' + a.pvs + '"售价不能为空';
					return;
				}
				if (!a.inventory.original_price) {
					str = '规格"' + a.pvs + '"原价不能为空';
					return;
				}
				if (!a.inventory.total) {
					str = '规格"' + a.pvs + '"库存不能为空';
					return;
				}
			});
			this.attachlist.forEach(a => {});
			return str;
		},
		//SKU批量设置参数
		setAll() {
			this.tabledata.forEach(e => {
				//批量设置划线价
				if (this.batch.original_price) {
					e.original_price = this.batch.original_price;
				}
				//批量设置销售价
				if (this.batch.sell_price) {
					e.sell_price = this.batch.sell_price;
				}
				//批量设置重量
				if (this.batch.weight) {
					e.weight = this.batch.weight;
				}
				//批量设置库存
				if (this.batch.total) {
					e.total = this.batch.total;
				}
			});
			this.showbatch = false;
		},
		showaddskuing() {
			this.sku_valuelist = JSON.parse(JSON.stringify(this.obj.sku_value));
			this.showaddsku = true;
		},
		savesku() {
			this.obj.sku_value = JSON.parse(JSON.stringify(this.sku_valuelist));
			this.formatSkuData();
			this.showaddsku = false;
		},
		//添加SKU项
		addSkuItem() {
			this.sku_valuelist.push({
				name: '',
				attrValue: [],
				has_pic: 0
			});
		},
		//删除SKU项
		removeSkuItem(i) {
			this.sku_valuelist.splice(i, 1);
		},
		//添加SKU值
		addSkuValue(i) {
			this.sku_valuelist[i].attrValue.push({
				value: ''
			});
		},
		//删除SKU值
		removeSkuValue(i, l) {
			if (this.sku_valuelist[i].attrValue.length > 1) {
				this.sku_valuelist[i].attrValue.splice(l, 1);
				this.formatSkuData();
			}
		},
		//初始化SKU数据
		formatSkuData() {
			this.rk++;
			let sl = this.obj.sku_value,
				list = [],
				keylist = [];
			//查询出启用pic的sku_item下标
			let index = sl.findIndex(e => e.has_pic == true);

			sl.forEach((e, i) => {
				keylist.push(e.name);
				//预处理attrValue数据,添加sku的key值以及父ID
				e.attrValue.forEach(ee => {
					ee.name = e.name;
					ee.pid = e.id;
				});

				list.push(e.attrValue);
				if (i == index) {
					keylist.push('图片');
					list.push([
						{
							value: ''
						}
					]);
				}
			});

			this.keylist = keylist;

			let alist = doCombination(list);

			let t = [];
			alist.forEach((e, i) => {
				let o = {
					pvs_value: ''
				};

				for (let i = 0, l = this.keylist.length; i < l; i++) {
					let d = 'k' + i;
					if (this.keylist[i] == '图片') {
						o[d] = e[i].value ? e[i].value : '';
					} else {
						o.pvs_value = o.pvs_value ? o.pvs_value + ',' + e[i].value : e[i].value;
						o[d] = e[i].value ? e[i].value : '#';
					}
				}

				//添加参数
				if (this.$route.query.id) {
					//编辑状态
					if (this.obj.has_sku) {
						o.weight = 0;
						o.original_price = 0;
						o.sell_price = 0;
						o.total = 0;
						o.store_inventory = [];
						o.pic = '';

						o.level_price = this.initlevelprice();
						//定位数据
						let tls = [],
							s = '';
						tls = e.filter(_ => {
							return _.value != '';
						});
						//拼装标志
						tls.forEach(e => {
							s += e.pid + ':' + e.id + ',';
						});
						s = s.substring(0, s.length - 1);

						//定位
						let target = this.obj.sku.filter(_ => {
							return _.pvs == s;
						});
						if (target.length > 0) {
							o.weight = target[0].weight;
							o.original_price = target[0].inventory.original_price;
							o.sell_price = target[0].inventory.sell_price;
							//o.total = target[0].inventory.total;
							o.total = target[0].inventory.total - target[0].inventory.sell;
							o.sell = target[0].inventory.sell;
							o.store_inventory = [];
							o.pic = target[0].pic;
							let key = 'sku' + target[0].inventory.sku_id;
							this.setimg(key, 3, o.pic);
							if (target[0].inventory.level_price) {
								o.level_price = target[0].inventory.level_price;
							} else {
								o.level_price = this.initlevelprice();
							}
							o.pid = target[0].id;
							o.id = target[0].inventory.id;
							o.sku_id = target[0].inventory.sku_id;

							//实时库存
							o.tsum = target[0].inventory.total - target[0].inventory.sell;
						}
					}
				} else {
					o.weight = 0;
					o.original_price = 0;
					o.sell_price = 0;
					o.total = 0;
					o.store_inventory = [];
					o.pic = '';
					let key = 'sku' + i;
					this.setimg(key, 3, o.pic);
					o.level_price = {type: this.obj.level_price_type, price: []};
					this.MembershipList.forEach(a => {
						o.level_price.price.push({level: a.level, price: 0, type: 1});
					});
				}

				t.push(o);
			});
			this.tabledata = t;
		},
		changesku(e) {
			if (e) {
				this.formatSkuData();
			}
		},
		/*附加属性*/

		addattach() {
			this.attachlist.push({
				name: '',
				need: 1,
				toplimit: 1,
				list: [
					{
						name: '',
						price: 0,
						total: 0
					}
				]
			});
		},
		addattachitem(i) {
			this.attachlist[i].list.push({
				name: '',
				price: 0,
				total: 0
			});
		},
		removeattach(i) {
			this.attachlist.splice(i, 1);
		},
		removeattachitem(i, l) {
			this.attachlist[i].list.splice(l, 1);
		},
		/*商品参数*/
		//添加参数条数
		addParameter() {
			this.obj.parameter.push({
				key: '',
				value: ''
			});
		},
		//删除参数条数
		removeParameter(i) {
			this.obj.parameter.splice(i, 1);
		},
		/*分类*/
		setclassify() {
			this.$refs.cascader.init(this.classify_id);
		},
		changecheck(list) {
			this.classify_id = list;
			let classify_value = [];
			list.forEach(a => {
				let i = this.allcate.findIndex(_ => _.value == a);
				classify_value.push(this.allcate[i].label);
			});
			this.obj.classify_value = classify_value.join(',');
			this.showcate = false;
		},
		/*详情*/
		getcontent(a) {
			this.obj.content = a.html;
		},
		cancal() {
			uni.$u.route({
				type: 'navigateBack',
				delta: 1
			});
		}
	}
};
</script>

<style lang="scss">
.tabs-box {
	height: 88rpx;
	background-color: #fff;
}
.swiper-div {
	height: calc(100vh - 208rpx);
	background-color: #fff;
}
.batch-div {
	font-size: 30rpx;
	padding-bottom: 20rpx;
}
.sku-div {
	height: 50vh;
}
</style>
